<template>
    <div class="dischargeport">
        <div class="h20">选择企业代码类型</div>
        <Form ref="formInline" :model="searchData" :label-width="100" inline>
            <Row>
                <Col span="6">
                <FormItem label="国家(地址)名称 ">
                    <Input height="22px" v-model="searchData.dataName" placeholder=""></Input>
                </FormItem>
                </Col>
                <Col span="8">
                <FormItem label="国家(地区)英文名称">
                    <Input height="22px" v-model="searchData.dataEngName" placeholder=""></Input>
                </FormItem>
                </Col>
                <Col span="6">
                <FormItem label="企业代码类型">
                    <Input height="22px" v-model="searchData.shortName" placeholder=""></Input>
                </FormItem>
                </Col>
                <Col span="4">
                <FormItem>
                    <Button type="primary" @click="getList()">查询</Button>
                </FormItem>
                </Col>
            </Row>
        </Form>
        <el-table ref="" :data="this.list" border highlight-current-row max-height="180" @row-click="dClick" class="table-list" >
            <el-table-column prop="dataName" label="国家(地址)名称 " ></el-table-column>
            <el-table-column prop="dataEngName" label="国家(地区)英文名称 " ></el-table-column>
            <el-table-column prop="shortName" label="企业代码类型 "></el-table-column>
        </el-table>
        <div class="content-footer">
            <Page
                @on-change="currentChange"
                @on-page-size-change="pageSizeChange"
                :page-size="searchData.pageSize"
                :current="searchData.pageNum"
                :total="total"
                :transfer="true"
                show-total
                show-sizer
                show-elevator
            />
        </div>
    </div>

</template>
<script>
import { getNoticeType } from '@/api/sea.js'
export default {
    name: 'OpenConsigneeType',
    props: ['name'],
    data () {
        return {
            total: 0,
            list: [],
            searchData: {
                dataCode: '',
                dataMainType: 'ENTERPRISE_CODE_TYPE',
                dataName: '',
                shortName: '',
                id: '',
                keyWord: '',
                pageNum: 1,
                pageSize: 10
            }

        }
    },
    created () {
        // 企业
        this.getList()
    },
    methods: {
        // 企业
        getList () {
            getNoticeType(this.searchData).then(res => {
                this.list = res.data.data.list
                this.total = res.data.data.total
            }).catch(err => {
                // this.getList()
            })
        },
        // 页码改变回调
        currentChange (v) {
            this.searchData.pageNum = v
            this.getList()
        },
        // 每页条数改变回调
        pageSizeChange (v) {
            this.searchData.pageSize = v
            if (this.searchData.pageNum === 1) {
                this.getList()
            }
        },
        dClick (row) {
            console.log(row)
            if (this.name == 'ce') {
                this.$emit('getCeValue', row.shortName)
            } else if (this.name == 'not') {
                this.$emit('getNotValue', row.shortName)
            }
        }

    }
}
</script>
<style lang="less"  scoped>
.dischargeport{
    .content-footer{
    margin-top: 10px;
    float:right;
    }

}
.h20{
    font-weight: bold;
    margin-bottom: 10px;
    height:20px;
    line-height: 20px;
    color:#000;
}
.red{
    color:red;
}

</style>
